@echo off
chcp 65001
echo [INFO] 手动编译 cbp2make_ai 统一处理器...
echo.

set WXWIN=D:\vc\wxWidgets-3.2.7
set MINGW_PATH=D:\vc\mingw64

:: 检查编译器
if not exist "%MINGW_PATH%\bin\g++.exe" (
    echo [ERROR] MinGW 编译器未找到: %MINGW_PATH%\bin\g++.exe
    echo [INFO] 请修改 MINGW_PATH 变量指向您的 MinGW 安装目录
    pause
    exit /b 1
)

:: 设置 PATH
set PATH=%MINGW_PATH%\bin;%PATH%

:: 编译命令
echo [INFO] 正在编译...
g++ -std=c++11 ^
    -I"%WXWIN%/include" ^
    -I"%WXWIN%/include/msvc" ^
    -D__GNUWIN32__ ^
    -DwxUSE_GUI=1 ^
    -O2 -Wall -Wextra ^
    main_unified.cpp workspace_parser.cpp ^
    -L"%WXWIN%/lib/gcc_x64_dll" ^
    -lwxmsw32u_core -lwxbase32u ^
    -lwxpng -lwxjpeg -lwxtiff -lwxzlib ^
    -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 ^
    -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid ^
    -lcomctl32 -lrpcrt4 -loleacc -luxtheme ^
    -o cbp2make_ai.exe

if %errorlevel% neq 0 (
    echo [ERROR] 编译失败!
    pause
    exit /b 1
)

echo [SUCCESS] 编译完成!
echo [INFO] 可执行文件: cbp2make_ai.exe
echo.
dir cbp2make_ai.exe
echo.
pause
